package com.qianyu.project.web.controller.nyx;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.qianyu.project.entity.DesignModify;
import com.qianyu.project.entity.SystemUser;
import com.qianyu.project.service.IDesignModifyService;
import com.qianyu.project.service.ISystemUserService;
import com.qianyu.project.utils.Result;
import com.qianyu.project.utils.ResultTool;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;

@RestController
@RequestMapping("NyxDesignModify")
public class NyxDesignModifyController {

    @Autowired
    private IDesignModifyService designModifyService;

    @GetMapping("")
    public Result getList(@RequestParam Map<String, String> map){
        return ResultTool.success(designModifyService.getList(map));
    }

    @DeleteMapping("/{id}")
    public Result del(@PathVariable String id){
        designModifyService.removeByIds(Arrays.asList(id.split(",").clone()));
        return ResultTool.success();
    }

    @GetMapping("/id")
    public Result getId(){
        return ResultTool.success(designModifyService.getId());
    }

    @PostMapping("")
    public Result save(@RequestBody DesignModify designModify){
        designModifyService.add(designModify);
        return  ResultTool.success();
    }

    @PutMapping("")
    public Result update(@RequestBody DesignModify designModify){
        designModifyService.updateDesign(designModify);
        return  ResultTool.success();
    }
}
